package org.electrode.task;

public class TaskWorker {
	final PeriodicTask initial;
	volatile PeriodicTask current;
	
	public TaskWorker(PeriodicTask initial) {
		this.initial = initial;
		this.current = null;
	}
	
	public void start() {
		if (null != current)
			return;
		initial.reset();
		current = initial;
	}
	
	public void step() {
		if (null == current) return;
		current = current.step();
	}
}
